package com.luwanglin.eduservice.controller.front;


import com.luwanglin.commonutils.R;
import com.luwanglin.eduservice.entity.EduCourse;
import com.luwanglin.eduservice.entity.EduTeacher;
import com.luwanglin.eduservice.service.EduCourseService;
import com.luwanglin.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author lwl
 * @since 2021-05-21
 */
@RestController
@RequestMapping("/eduservice/index")
public class CrmIndexController {
    @Autowired
    private EduCourseService courseService;
    @Autowired
    private EduTeacherService teacherService;

    //查询前8条热门课程，查询前4条名师
    @GetMapping("indexData")
    public R index() {
        //查询前8条热门课程

        List<EduCourse> eduCourseList = courseService.selectIndexCourseList();

        //查询前4条名师
        List<EduTeacher> teacherList = teacherService.selectIndexTeacherList();

        return R.ok().data("courseList", eduCourseList).data("teacherList", teacherList);
    }
}

